package com.example.myproject.redis.redisother;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * Created by xi on 2019/3/2.
 */
@Service
public class RedisService {
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    //向通道发送消息的方法
    public void sendChannelMess(String channel, Object message) {
        redisTemplate.convertAndSend(channel, message);
    }
}